import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useSystemStore = defineStore('system', () => {
  const darkMode = ref(false)

  function toggleDarkMode() {
    darkMode.value = !darkMode.value
    localStorage.setItem('darkMode', darkMode.value ? 'dark' : 'light')
    document.body.classList.toggle('dark', darkMode.value)
  }

  return {
    darkMode,
    toggleDarkMode
  }
})
